Conditions | 1 |
Paths | 1 |
Total Lines | 103 |
Code Lines | 82 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | demo = { |
||
287 | initGoogleMaps: function() { |
||
288 | var myLatlng = new google.maps.LatLng(40.748817, -73.985428); |
||
289 | var mapOptions = { |
||
290 | zoom: 13, |
||
291 | center: myLatlng, |
||
292 | scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page |
||
293 | styles: [{ |
||
294 | "featureType": "water", |
||
295 | "stylers": [{ |
||
296 | "saturation": 43 |
||
297 | }, { |
||
298 | "lightness": -11 |
||
299 | }, { |
||
300 | "hue": "#0088ff" |
||
301 | }] |
||
302 | }, { |
||
303 | "featureType": "road", |
||
304 | "elementType": "geometry.fill", |
||
305 | "stylers": [{ |
||
306 | "hue": "#ff0000" |
||
307 | }, { |
||
308 | "saturation": -100 |
||
309 | }, { |
||
310 | "lightness": 99 |
||
311 | }] |
||
312 | }, { |
||
313 | "featureType": "road", |
||
314 | "elementType": "geometry.stroke", |
||
315 | "stylers": [{ |
||
316 | "color": "#808080" |
||
317 | }, { |
||
318 | "lightness": 54 |
||
319 | }] |
||
320 | }, { |
||
321 | "featureType": "landscape.man_made", |
||
322 | "elementType": "geometry.fill", |
||
323 | "stylers": [{ |
||
324 | "color": "#ece2d9" |
||
325 | }] |
||
326 | }, { |
||
327 | "featureType": "poi.park", |
||
328 | "elementType": "geometry.fill", |
||
329 | "stylers": [{ |
||
330 | "color": "#ccdca1" |
||
331 | }] |
||
332 | }, { |
||
333 | "featureType": "road", |
||
334 | "elementType": "labels.text.fill", |
||
335 | "stylers": [{ |
||
336 | "color": "#767676" |
||
337 | }] |
||
338 | }, { |
||
339 | "featureType": "road", |
||
340 | "elementType": "labels.text.stroke", |
||
341 | "stylers": [{ |
||
342 | "color": "#ffffff" |
||
343 | }] |
||
344 | }, { |
||
345 | "featureType": "poi", |
||
346 | "stylers": [{ |
||
347 | "visibility": "off" |
||
348 | }] |
||
349 | }, { |
||
350 | "featureType": "landscape.natural", |
||
351 | "elementType": "geometry.fill", |
||
352 | "stylers": [{ |
||
353 | "visibility": "on" |
||
354 | }, { |
||
355 | "color": "#b8cb93" |
||
356 | }] |
||
357 | }, { |
||
358 | "featureType": "poi.park", |
||
359 | "stylers": [{ |
||
360 | "visibility": "on" |
||
361 | }] |
||
362 | }, { |
||
363 | "featureType": "poi.sports_complex", |
||
364 | "stylers": [{ |
||
365 | "visibility": "on" |
||
366 | }] |
||
367 | }, { |
||
368 | "featureType": "poi.medical", |
||
369 | "stylers": [{ |
||
370 | "visibility": "on" |
||
371 | }] |
||
372 | }, { |
||
373 | "featureType": "poi.business", |
||
374 | "stylers": [{ |
||
375 | "visibility": "simplified" |
||
376 | }] |
||
377 | }] |
||
378 | |||
379 | } |
||
380 | var map = new google.maps.Map(document.getElementById("map"), mapOptions); |
||
381 | |||
382 | var marker = new google.maps.Marker({ |
||
383 | position: myLatlng, |
||
384 | title: "Hello World!" |
||
385 | }); |
||
386 | |||
387 | // To add the marker to the map, call setMap(); |
||
388 | marker.setMap(map); |
||
389 | }, |
||
390 | |||
408 | }; |